<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      //charAt(index) 根据位置返回字符串
      var str = "north";
      console.log(str.charAt(3)); //t
      //遍历字符串
      for (i = 0; i < str.length; i++) {
        console.log(str.charAt(i));
      }

      //charCodeAt(index)  返回相应许索引号的ASCII值 目的 判断用户按下了哪个键
      console.log(str.charCodeAt(0)); //110

      //str[index]
      console.log(str[0]);
    </script>
  </head>
  <body></body>
</html>
